// packageAPI/pages/route/event-channel/emit-page.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    schema:[
    ],
    formData:{
    },
    title: '',
    result: '',
    remark: '',
    webUrl: 'https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html',
    zh: 'VideoContext.exitPictureInPicture',
    apiName: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    wx.setNavigationBarTitle({
      title: '接收数据',
    })
    
    this.setData({
      title: '接收数据'
    })
    const that = this;
    const EventChannel = this.getOpenerEventChannel()
    EventChannel.on('acceptDataFromOpenedPage', function(res) {
      that.videoContext = res.data
    })
  },
  choose1() {
    const that = this;
    this.videoContext.exitPictureInPicture({
      success(res) {
        that.setData({
          result: res,
          apiName: 'VideoContext.exitPictureInPicture'
        })
      },
      fail(err) {
        that.setData({
          result: err,
          apiName: 'VideoContext.exitPictureInPicture'
        })
      }
    })
  }
})